<template>
  <BasicModal v-bind="$attrs" destroyOnClose title="店铺选择" @ok="handleOk"   width="60%" @register="registerModal" >
    <ShopSelect ref="shopSelect"></ShopSelect>
  </BasicModal>
</template>
<script lang="ts" setup>
import { getCurrentInstance, ref } from 'vue';
import { BasicModal, useModalInner } from '@apps/antd-admin/src/components/modal';
import ShopSelect from './ShopSelect.vue';
import {batchSave} from "../../data/bag.api";
let couponId = ref('');
const emit = defineEmits(['success', 'register']);
const ctx: any = getCurrentInstance();
const [registerModal, { setModalProps ,closeModal}] = useModalInner(async (data) => {
  let record = data.record;
  couponId=record.couponId;
  ctx.refs['shopSelect'].setSearchInfoProps();
});
/**
 * 确定选择
 */
function handleOk() {
  let ids=ctx.refs['shopSelect'].getSelected();
  batchSave(couponId,ids.join(",")).then(res => {
    emit("success",false);
    closeModal();
  })
}
</script>
